using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableAdminAccount
	{
		public const string Table = "AdminAccount";
		public const string AdminAccountID = "AdminAccountID";
		public const string AdministratorID = "AdministratorID";
		public const string AccountObjectID = "AccountObjectID";
		public const string AccountType = "AccountType";
	}
	
	[Serializable]
	public class BaseAdminAccount
		: IDbSessionEntity, IJsonClass
	{
		int m_AdminAccountID;
		/// <summary>
        /// 
        /// </summary>
        public int AdminAccountID
        {
            get { return m_AdminAccountID; }
            set { m_AdminAccountID = value; }
        }
		
		int? m_AdministratorID;
		/// <summary>
        /// 
        /// </summary>
        public int? AdministratorID
        {
            get { return m_AdministratorID; }
            set { m_AdministratorID = value; }
        }
		
		int m_AccountObjectID;
		/// <summary>
        /// 
        /// </summary>
        public int AccountObjectID
        {
            get { return m_AccountObjectID; }
            set { m_AccountObjectID = value; }
        }
		
		int m_AccountType;
		/// <summary>
        /// 
        /// </summary>
        public int AccountType
        {
            get { return m_AccountType; }
            set { m_AccountType = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_AdminAccountID = reader[TableAdminAccount.AdminAccountID];
            m_AdministratorID = reader[TableAdminAccount.AdministratorID];
            m_AccountObjectID = reader[TableAdminAccount.AccountObjectID];
            m_AccountType = reader[TableAdminAccount.AccountType];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableAdminAccount.AdminAccountID, PrimaryKeyType.Identity, AdminAccountID);
			writer[TableAdminAccount.AdministratorID] = AdministratorID;
			writer[TableAdminAccount.AccountObjectID] = AccountObjectID;
			writer[TableAdminAccount.AccountType] = AccountType;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_AdminAccountID = idd;
        }
		
		public string TableName
        {
            get { return TableAdminAccount.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_AdminAccountID = hashToRead["AdminAccountID"];
			 
             m_AdministratorID = hashToRead["AdministratorID"];
			 
             m_AccountObjectID = hashToRead["AccountObjectID"];
			 
             m_AccountType = hashToRead["AccountType"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["AdminAccountID"] = AdminAccountID;
			 
            hashToFill["AdministratorID"] = AdministratorID;
			 
            hashToFill["AccountObjectID"] = AccountObjectID;
			 
            hashToFill["AccountType"] = AccountType;
			 
        }

        #endregion
		
	}
}
